<?php

/**
 * Researcher form base class.
 *
 * @method Researcher getObject() Returns the current form's model object
 *
 * @package    Redsea20
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseResearcherForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'firstname'    => new sfWidgetFormInputText(),
      'lastname'     => new sfWidgetFormInputText(),
      'emailaddress' => new sfWidgetFormInputText(),
      'password'     => new sfWidgetFormInputText(),
      'university'   => new sfWidgetFormTextarea(),
      'position'     => new sfWidgetFormTextarea(),
      'address'      => new sfWidgetFormTextarea(),
      'contact'      => new sfWidgetFormInputText(),
      'gender'       => new sfWidgetFormInputText(),
      'birthdate'    => new sfWidgetFormDate(),
      'picture'      => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'firstname'    => new sfValidatorString(array('max_length' => 50)),
      'lastname'     => new sfValidatorString(array('max_length' => 50)),
      'emailaddress' => new sfValidatorString(array('max_length' => 100)),
      'password'     => new sfValidatorString(array('max_length' => 20)),
      'university'   => new sfValidatorString(),
      'position'     => new sfValidatorString(),
      'address'      => new sfValidatorString(),
      'contact'      => new sfValidatorString(array('max_length' => 50)),
      'gender'       => new sfValidatorString(array('max_length' => 6)),
      'birthdate'    => new sfValidatorDate(),
      'picture'      => new sfValidatorString(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('researcher[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Researcher';
  }

}
